This invention relates to computer graphics. More particularly, the invention relates to techniques for accessing texture data stored in a computer for use in texture mapping operations by a graphics display subsystem.
In the field of computer graphics, texture mapping is a known technique used to create the appearance of complexity on the surface of rendered objects without actually having to model every detail of the object""s surface. Typically, the technique involves mapping a two-dimensional function or array onto an object in three-dimensional object space and then projecting the resultant image back to two-dimensional screen space for display. The term xe2x80x9ctexture mapxe2x80x9d refers to the function or array that is used in the texture mapping process. A common array-based texture map might consist of a repeatable pattern for representing a material, such as wood or marble for example. Such texture maps are made up of a plurality of numerical values called texels. A texel""s numerical value usually corresponds to an RGB color value and perhaps also to an alpha transparency value. (Although other parameters may be included in texture maps in addition to, or in lieu of, RGB and alpha values.) A texel""s location within a texture map may be designated using s,t coordinates.
A technique known as mipmapping is also used in texture mapping. The acronym xe2x80x9cmipxe2x80x9d stands for multum in parvoxe2x80x94multiple things in one place. In mipmapping, numerous versions of the same texture map are created, each version representing the texture at a different resolution. After this has been done, the process of texture mapping may be performed using only those versions of the texture map that are appropriate given the resolution required for the object being drawn. To create the different versions of the texture map, a base texture map is down-sampled numerous times to develop a series of smaller texture maps, each of which represents the base map at a predetermined lower level of resolution. A more detailed explanation of mipmapping may be found, for example, in Lance Williams, xe2x80x9cPyramidal Parametrics,xe2x80x9d Computer Graphics Vol. 17, No. 3, pp.1-10 (July, 1983). Hereinafter, the different resolution versions of a texture map that in the aggregate constitute a mipmap will be referred to as xe2x80x9cpages,xe2x80x9d or xe2x80x9cmipmap pages.xe2x80x9d
While mipmaps yield important efficiencies for rendering complex images, they can become burdensome in terms of the amount of memory that is required to store them. Indeed, the size of the mipmaps used to render an image can in some cases be larger than the rendered image itself. This is particularly problematic given that, in the past, texture data was stored exclusively within the graphics subsystem (such as in the frame buffer memory or in a dedicated texture memory). One technique now being used to work around the texture data storage problem is to store mipmaps in the system memory of the host computer as well as in memory located within the graphics subsystem. When this technique is employed, the graphics subsystem uses direct memory access to retrieve texture data from system memory as needed. This new technique is beneficial to the extent that it reduces the need for expensive memory in the graphics subsystem. (Ample and relatively inexpensive storage space is often available in system memory.) Unfortunately, the technique also creates new problems:
First, there is overhead associated with retrieving texture data from system memory into graphics subsystem memory. For example, each time a texel address is generated by graphics rendering hardware, the graphics subsystem must determine whether to initiate a direct memory access request to system memory for the required texel data, or whether simply to retrieve the texel data from a memory located locally within the graphics subsystem. In prior art machines, a texture address comparator is provided for this purpose. Reference addresses are stored to indicate the boundaries of system memory and graphics subsystem memory. Every time a texel address is generated, it is compared with the reference addresses to determine whether a direct memory access will be required. Texel addresses are generated with enormous frequency, and each address comparison takes time. Thus, storing texture data in system memory can reduce the performance of a graphics system even when texture data is not being moved from system memory to graphics subsystem memory. The extra hardware required to perform the address comparison function has a cost associated with it as well. It is therefore an object of the invention to provide a mechanism and technique for very quickly determining whether it is necessary to access the system memory of the host computer for the purpose of retrieving a particular unit of texture data.
Another problem that arises with storage of texture data in system memory has to do with fixed relative addressing. In prior art systems that use fixed relative addressing, all of the pages of a mipmap must be located within the same memory in order to be used. In other words, the texels in a mipmap structure can be accessed individually only as long as all of the pages of the mipmap are located either in system memory, frame buffer memory or texture memory. It is not permitted in such systems to locate one of the pages of a mipmap in frame buffer memory and the remaining pages in system memory, for example. This is because, in fixed relative addressing, the location of each texel in a mipmap is defined relative to the beginning address of the base page of the overall mipmap structure.
For example, referring now to FIG. 1, the pages of a mipmap n are used to represent one texture at varying levels of detail. The largest page of mipmap n, page 0, is used to represent the texture at the highest level of detail. Pages 1, 2 and 3 are used to represent the same texture at successively lesser levels of detail. Each of pages 1, 2 and 3 is a down-sampled version of the previous page. If page 0 were 256xc3x97256 texels in size, then pages 1, 2 and 3 would typically be 128xc3x97128, 64xc3x9764 and 32xc3x9732 texels in size, respectively. Each of the pages in mipmap n has a base address associated with it, indicated in the drawing at 100-106. In a fixed relative addressing scheme, the pages of a mipmap n are stored in memory in such a manner that only the base address of page 0 need be known in order to access texels within any of the pages of the mipmap n. In short, the base address location for a given page is xe2x80x9cfixedxe2x80x9d relative to the base addresses for the other pages in the same mipmap. The base address for page 0 of the mipmap is used as the primary point of reference. For example, the pages may be stored contiguously so that the base address for page 1 will always be equal to [the base address for page 0]+65,536*[size of a texel]. The base address for page 2 will be equal to [the base address for page 1]+16,384*[size of a texel], and so on. Alternatively, the pages of the mipmaps may be stored so that they are not contiguous with one another, so long as the base addresses for each of the down-sampled pages of a given mipmap may calculated solely from the base address of page 0 of that mipmap.
Although fixed relative addressing provides simplicity, it also involves constraints. For instance, in some applications it would be desirable to have some of the frequently-accessed pages of a mipmap reside in (fast) graphics subsystem memory and to have some of the less-frequently-accessed pages of the mipmap reside in (slower) system memory. In a system that uses fixed relative addressing, such a scheme is not possible. It is therefore a further object of the invention to provide the flexibility to store the pages of a mipmap at random locations either within the system memory of the host computer, in a frame buffer memory or in a dedicated texture memory.
The invention includes a number of unique aspects, each of which contributes to the achievement of the above-stated objects.
In one aspect, the invention includes the use of page residence indicators to obviate the need for address comparisons during texel accessing. A mipmap page number is generated for texture data of interest. A page residence bit is then selected responsive to the mipmap page number. If the page residence bit is in a first state, then the texel is retrieved from a memory located within the graphics subsystem; but if the page residence bit is in a second state, then the texel is retrieved from system memory. The step of selecting a page residence bit may include the step of decoding the mipmap page number to select one of a plurality of page residence registers in a register file.
In another aspect, the invention includes the use of system-wide texture offset addressing to obviate the constraints associated with fixed relative addressing schemes. To access texture data of interest, a mipmap page base address is generated responsive to the mipmap page number of the texture data of interest; an offset is generated responsive to the mipmap page number and the s,t coordinates of the texture data of interest; and the offset is added to the mipmap page base address to produce an absolute texel address. Because the mipmap page base address is generated responsive only to the mipmap page number, the various pages constituting a mipmap may be stored at random locations within the computer system. The step of generating a mipmap page base address may include the steps of applying the mipmap page number to the output select input of a register file; and taking the mipmap page base address from the output of the register file.